package org.kardigen.lg.admin.client.training.event;

import org.kardigen.lg.service.client.proxy.TrainingChapterProxy;
import org.kardigen.lg.service.client.proxy.TrainingProxy;
import org.kardigen.lg.service.client.proxy.WordProxy;

import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;

public class WordSelectionEvent extends GwtEvent<WordSelectionEvent.Handler> {

	public interface Handler extends EventHandler {

		void onEvent(WordSelectionEvent trainingEvent);
	}

	public static Type<WordSelectionEvent.Handler> TYPE = new Type<WordSelectionEvent.Handler>();
	private final TrainingChapterProxy parent;
	private final WordProxy word;
	private final TrainingProxy root;

	public WordSelectionEvent(TrainingProxy root, TrainingChapterProxy parent, WordProxy word) {
		this.root = root;
		this.parent = parent;
		this.word = word;
	}

	@Override
	public Type<Handler> getAssociatedType() {
		return TYPE;
	}

	@Override
	protected void dispatch(Handler handler) {
		handler.onEvent(this);
	}

	public TrainingChapterProxy getParent() {
		return parent;
	}

	public WordProxy getWord() {
		return word;
	}

	public TrainingProxy getRoot() {
		return root;
	}

}
